package com.yingxin.yx.framework.tool.string;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

/**
 * 字符工具类
 */

public class MyStringTool {

    /**
     * 分割字符串返回list
     */
    public static List<String> split(String str, String split) {
        if( StringUtils.isBlank( str ) ){
            return null;
        }
        if( StringUtils.isBlank( split ) ){
            return null;
        }
        StringTokenizer tokenizer = new StringTokenizer( str, split );
        List<String> result = new ArrayList<>();
        while ( tokenizer.hasMoreTokens() ){
            result.add( tokenizer.nextToken() );
        }
        return result;
    }

}
